{include file="pub_header.htm"}
<div class="out_table">
<table width="100%" cellpadding="6" cellspacing="6" border="0" align="center" class="frame_table">
  <tr>
    <td width="20%" align="center" valign="top" bgcolor="#EEEEEE">
      {include file="pub_submenu.htm"}
    </td>
    <td width="80%" align="center" valign="top" bgcolor="#FFFFFF">

      {if $get.ope == "add"}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=add" target="_self" class="current_place">模型添加</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <form id="setmodel_add" name="setmodel_add" method="post" action="javascript:void(null);" enctype="multipart/form-data">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="3">添加模型</td>
        </tr>
        <tr align="left">
          <td width="20%" class="block_left">模型名称</td>
          <td width="40%" class="block_right"><input type="text" id="name" name="name" maxlength="11" size="50" value="" class="input"></td>
          <td width="40%" class="block_right"><span id="name_return"><span class="prompt_primal"></span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">模型标识</td>
          <td class="block_right"><input type="text" id="code" name="code" maxlength="60" size="50" value="" class="input"></td>
          <td class="block_right"><span id="code_return"><span class="prompt_primal"></span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">简单介绍</td>
          <td class="block_right"><textarea id="brief" name="brief" rows="6" cols="50" class="textarea"></textarea></td>
          <td class="block_right"><span id="brief_return"><span class="prompt_primal">对此模型的简单介绍</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">频道页模板</td>
          <td class="block_right"><input type="text" name="template_channel" maxlength="255" size="50" value="" class="input"></td>
          <td class="block_right"><span id="template_channel_return"><span class="prompt_primal">本频道综合调用页,留空为默认</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">详细页模板</td>
          <td class="block_right"><input type="text" name="template_content" maxlength="255" size="50" value="" class="input"></td>
          <td class="block_right"><span id="template_content_return"><span class="prompt_primal">本频道内容详细页,留空为默认</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">横向分类</td>
          <td class="block_right">
          <table cellspacing="0" cellpadding="1" border="0">
            {foreach name=trans_group from=$trans_group item=trans_group}
            <tr>
              <td class="block_left"><input type="checkbox" name="trans_group[{$trans_group.id}][check]" value="1">{$trans_group.name|str_entag:'space,br'}</td>
              <td>
                必填:<input type="checkbox" name="trans_group[{$trans_group.id}][if_must]" value="1">
                排序:<input type="text" name="trans_group[{$trans_group.id}][rank]" maxlength="11" size="6" value="0" class="input">
              </td>
              <td><span id="trans_group_return{$trans_group.id}_return"><span class="prompt_primal"></span></span></td>
            </tr>
            {/foreach}
          </table>
          </td>
          <td class="block_right"><span id="trans_group_return"><span class="prompt_primal">横向分类的设定</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">状态</td>
          <td class="block_right">
            <input type="radio" name="if_enable" value="1" checked class="radio_y">&nbsp;开启
            <input type="radio" name="if_enable" value="2" class="radio_n">&nbsp;关闭
          </td>
          <td class="block_right"><span id="if_enable_return"><span class="prompt_primal">是否开启此模型</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">排序</td>
          <td class="block_right"><input type="text" id="rank" name="rank" maxlength="11" size="50" value="0" class="input"></td>
          <td class="block_right"><span id="rank_return"><span class="prompt_primal">排序</span></span></td>
        </tr>
        <tr>
          <td colspan="3" align="center" class="block_footer">
          <input type="button" id="setmodel_submit" name="setmodel_submit" value="添加" class="button"
            onclick="xajax.$('setmodel_submit').disabled=true;
                     xajax.$('setmodel_submit').value='请等待...';
                     xajax_submit_form('add',xajax.getFormValues('setmodel_add'),'setmodel_submit');">
          </td>
        </tr>
      </table>
      </form>
      </div>
      {elseif $get.ope == "amend"}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=amend&setmodel_id={$setmodel_detail.id}" target="_self" class="current_place">模型修改[{$setmodel_detail.name}]</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel&ope=add" target="_self" class="current_place">模型添加</a>
            <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <form id="setmodel_amend" name="setmodel_amend" method="post" action="javascript:void(null);" enctype="multipart/form-data">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="3">编辑模型</td>
        </tr>
        <tr align="left">
          <td width="20%" class="block_left">ID</td>
          <td width="40%" class="block_right">{$setmodel_detail.id}</td>
          <td width="40%" class="block_right"></td>
        </tr>
        <tr align="left">
          <td class="block_left">模型名称</td>
          <td class="block_right"><input type="text" id="name" name="name" maxlength="11" size="50" value="{$setmodel_detail.name}" class="input"></td>
          <td class="block_right"><span id="name_return"><span class="prompt_primal"></span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">模型标识</td>
          <td class="block_right"><input type="text" id="code" name="code" maxlength="60" size="50" value="{$setmodel_detail.code}" class="input"></td>
          <td class="block_right"><span id="code_return"><span class="prompt_primal"></span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">简单介绍</td>
          <td class="block_right"><textarea id="brief" name="brief" rows="6" cols="50" class="textarea">{$setmodel_detail.brief|str_entag}</textarea></td>
          <td class="block_right"><span id="brief_return"><span class="prompt_primal">对此模型的简单介绍</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">频道页模板</td>
          <td class="block_right"><input type="text" name="template_channel" maxlength="255" size="50" value="{$setmodel_detail.template_channel}" class="input"></td>
          <td class="block_right"><span id="template_channel_return"><span class="prompt_primal">本频道综合调用页,留空为默认</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">详细页模板</td>
          <td class="block_right"><input type="text" name="template_content" maxlength="255" size="50" value="{$setmodel_detail.template_content}" class="input"></td>
          <td class="block_right"><span id="template_content_return"><span class="prompt_primal">本频道内容详细页,留空为默认</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">横向分类</td>
          <td class="block_right">
          <table cellspacing="0" cellpadding="1" border="0">
            {foreach name=trans_group from=$trans_group item=trans_group}
            {if $trans_group.id|in_array_key:$trans_list}
            <tr>
              <td class="block_left"><input type="checkbox" name="trans_group[{$trans_group.id}][check]" value="1" checked>{$trans_group.name|str_entag:'space,br'}</td>
              <td>
                必填:<input type="checkbox" name="trans_group[{$trans_group.id}][if_must]" value="1" {if $trans_list[$trans_group.id].if_must == "1"}checked{/if}>
                排序:<input type="text" name="trans_group[{$trans_group.id}][rank]" maxlength="11" size="6" value="{$trans_list[$trans_group.id].rank}" class="input">
              </td>
              <td><span id="trans_group_return{$trans_group.id}_return"><span class="prompt_primal"></span></span></td>
            </tr>
            {else}
            <tr>
              <td class="block_left"><input type="checkbox" name="trans_group[{$trans_group.id}][check]" value="1">{$trans_group.name|str_entag:'space,br'}</td>
              <td>
                必填:<input type="checkbox" name="trans_group[{$trans_group.id}][if_must]" value="1">
                排序:<input type="text" name="trans_group[{$trans_group.id}][rank]" maxlength="11" size="6" value="0" class="input">
              </td>
              <td><span id="trans_group_return{$trans_group.id}_return"><span class="prompt_primal"></span></span></td>
            </tr>
            {/if}
            {/foreach}
          </table>
          </td>
          <td class="block_right"><span id="trans_group_return"><span class="prompt_primal">横向分类的设定</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">状态</td>
          <td class="block_right">
            <input type="radio" name="if_enable" value="1" {if $setmodel_detail.if_enable == "1"}checked{/if} class="radio_y">&nbsp;开启
            <input type="radio" name="if_enable" value="2" {if $setmodel_detail.if_enable != "1"}checked{/if} class="radio_n">&nbsp;关闭
          </td>
          <td class="block_right"><span id="if_enable_return"><span class="prompt_primal">是否开启此模型</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">排序</td>
          <td class="block_right"><input type="text" id="rank" name="rank" maxlength="11" size="50" value="{$setmodel_detail.rank}" class="input"></td>
          <td class="block_right"><span id="rank_return"><span class="prompt_primal">排序</span></span></td>
        </tr>
        <tr>
          <td colspan="3" align="center" class="block_footer">
          <input type="button" id="setmodel_submit" name="setmodel_submit" value="编辑" class="button"
            onclick="xajax.$('setmodel_submit').disabled=true;
                     xajax.$('setmodel_submit').value='请等待...';
                     xajax_submit_form('amend',xajax.getFormValues('setmodel_amend'),'setmodel_submit');">
          </td>
        </tr>
      </table>
      </form>
      </div>
      {elseif $get.ope == "table"}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=table&setmodel_id={$setmodel_info.id}" target="_self" class="current_place">模型表列表[{$setmodel_info.name}]</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="9" height="25"><span class="float_left">模型表列表</span><span class="float_right"><img src="{$dir_images_admin}/icon_modify.gif" title="Warning" alt="Warning" align="absmiddle" /> 双击修改内容</span></td>
        </tr>
        <tr class="block_title">
          <td width="5%" height="25">ID</td>
          <td width="15%" nowrap>名称</td>
          <td width="15%" nowrap>标识</td>
          <td width="10%" nowrap>表类型</td>
          <td width="10%" nowrap>数据类型</td>
          <td width="5%" nowrap>预载入</td>
          <td width="10%" nowrap>排序</td>
          <td width="20%" nowrap>数据库表</td>
          <td width="10%" nowrap>操作</td>
        </tr>
        <tr align="center" class="block_subtitle">
          <td height="25">~</td>
          <td>基本表</td>
          <td>~</td>
          <td>FIXED</td>
          <td>单</td>
          <td>&radic;</td>
          <td>1</td>
          <td class="text_d" align="left">{$config_db_prefix}content</td>
          <td nowrap>~</td>
        </tr>
        {foreach name=table_list from=$table_list item=item}
        <tr align="center" class="block_list" onmouseover="this.className='block_list_over'" onmouseout="this.className='block_list'">
          <td height="25">
            {$item.id}
          </td>
          <td title="双击修改内容" ondblclick="xajax_set_value_onfocus('name', '{$item.id}', $('#name_{$item.id}_value').val(), 'text', 255, 'width:100px;text-align:center;');">
            <table width="100%" height="25" cellspacing="0" cellpadding="0" border="0" class="content_wrap"><tr><td class="dbclick_modify" align="center"><div id="name_{$item.id}" name="name_{$item.id}">{$item.name|str_entag:'space'}</div></td></tr></table>
            <input type="hidden" id="name_{$item.id}_value" name="name_{$item.id}_value" value="{$item.name|str_entag}">
          </td>
          <td title="双击修改内容" ondblclick="xajax_set_value_onfocus('code', '{$item.id}', $('#code_{$item.id}_value').val(), 'text', 255, 'width:80px;text-align:center;');">
            <table width="100%" height="25" cellspacing="0" cellpadding="0" border="0" class="content_wrap"><tr><td class="dbclick_modify" align="center"><div id="code_{$item.id}" name="code_{$item.id}">{$item.code}</div></td></tr></table>
            <input type="hidden" id="code_{$item.id}_value" name="code_{$item.id}_value" value="{$item.code|str_entag}">
          </td>
          <td title="双击更改内容" ondblclick="xajax_set_value_onfocus('rowformat', '{$item.id}', $('#rowformat_{$item.id}_value').val(), 'rowformat', 7, 'width:50px;text-align:left;');">
            <table width="100%" height="25" cellspacing="0" cellpadding="0" border="0" class="content_wrap"><tr><td class="dbclick_modify" align="center"><div id="rowformat_{$item.id}" name="rowformat_{$item.id}">{if $item.rowformat != "2"}FIXED{else}DYNAMIC{/if}</div></td></tr></table>
            <input type="hidden" id="rowformat_{$item.id}_value" name="rowformat_{$item.id}_value" value="{$item.rowformat}">
          </td>
          <td title="双击更改内容" ondblclick="xajax_set_value_onfocus('recordtype', '{$item.id}', $('#recordtype_{$item.id}_value').val(), 'recordtype', 7, 'width:50px;text-align:left;');">
            <table width="100%" height="25" cellspacing="0" cellpadding="0" border="0" class="content_wrap"><tr><td class="dbclick_modify" align="center"><div id="recordtype_{$item.id}" name="recordtype_{$item.id}">{if $item.recordtype != "2"}单{else}多{/if}</div></td></tr></table>
            <input type="hidden" id="recordtype_{$item.id}_value" name="recordtype_{$item.id}_value" value="{$item.recordtype}">
          </td>
          <td title="双击更改内容" ondblclick="xajax_set_value_onfocus('if_preload', '{$item.id}', $('#if_preload_{$item.id}_value').val(), 'checkbox', 255, 'text-align:center;');">
            <table width="100%" height="25" cellspacing="0" cellpadding="0" border="0" class="content_wrap"><tr><td class="dbclick_modify" align="center"><div id="if_preload_{$item.id}" name="if_preload_{$item.id}">{if $item.if_preload == "1"}&radic;{/if}</div></td></tr></table>
            <input type="hidden" id="if_preload_{$item.id}_value" name="if_preload_{$item.id}_value" value="{$item.if_preload}">
          </td>
          <td title="双击修改内容" ondblclick="xajax_set_value_onfocus('rank', '{$item.id}', $('#rank_{$item.id}_value').val(), 'text', 11, 'width:30px;text-align:center;');">
            <table width="100%" height="25" cellspacing="0" cellpadding="0" border="0" class="content_wrap"><tr><td class="dbclick_modify" align="center"><div id="rank_{$item.id}" name="rank_{$item.id}">{$item.rank}</div></td></tr></table>
            <input type="hidden" id="rank_{$item.id}_value" name="rank_{$item.id}_value" value="{$item.rank}">
          </td>
          <td>
            <div id="table_fullcode_{$item.id}" name="table_fullcode_{$item.id}" class="text_d" align="left">{$item.table_fullcode}</div>
          </td>
          <td nowrap>
            <a href="{$control_admin}?act=setmodel&ope=field_list&table_id={$item.id}" target="_self"><img src="{$dir_images_admin}/icon_list.gif" border="0" alt="表" title="模型表列表" /></a>
            <img src="{$dir_images_admin}/icon_delete.gif" border="0" alt="删" title="删除记录" style="cursor:pointer;" onclick="if (confirm('真的要删除本条记录?')) xajax_setmodel_table_del('{$item.id}');">
          </td>
        </tr>
        {/foreach}
      </table>
      <div class="space"></div>
      <form id="setmodel_table_add" name="setmodel_table_add" method="post" action="javascript:void(null);" enctype="multipart/form-data">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr class="block_footer" align="center">
          <td width="5%" height="25">&nbsp;</td>
          <td width="15%" nowrap><input type="text" id="name" name="name" size="16" maxlength="255" value="" class="input" style="width:100px;text-align:center;" /></td>
          <td width="15%" nowrap><input type="text" id="code" name="code" size="12" maxlength="255" value="" class="input" style="width:80px;text-align:center;" /></td>
          <td width="10%" nowrap>
            <select id="rowformat" name="rowformat" class="select" size="1"  style="width:50px;text-align:center;">
              <option value="1">FIXED</option>
              <option value="2" selected="selected">DYNAMIC</option>
            </select>
          </td>
          <td width="10%" nowrap>
            <select id="recordtype" name="recordtype" class="select" size="1"  style="width:50px;text-align:center;">
              <option value="1" selected="selected">单</option>
              <option value="2">多</option>
            </select>
          </td>
          <td width="5%" nowrap><input type="checkbox" id="if_preload" name="if_preload" value="1" class="checkbox" /></td>
          <td width="10%" nowrap><input type="text" id="rank" name="rank" size="3" maxlength="255" value="" class="input" style="width:30px;text-align:center;" /></td>
          <td width="20%" nowrap>&nbsp;</td>
          <td width="10%" nowrap>
            <input type="button" id="setmodel_table_submit" name="setmodel_table_submit" value="添加" class="button"
              onclick="xajax.$('setmodel_table_submit').disabled=true;
                       xajax.$('setmodel_table_submit').value='请等待...';
                       xajax_setmodel_table_add(xajax.getFormValues('setmodel_table_add'),'setmodel_table_submit');">
          </td>
        </tr>
      </table>
      </form>
      </div>
      {elseif $get.ope == "field_list"}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=table&setmodel_id={$table_info.setmodel_id}" target="_self" class="current_place">模型表列表[{$table_info.setmodel_name}]</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=field_list&table_id={$table_info.id}" target="_self" class="current_place">表字段列表[{$table_info.name}]</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel&ope=field_add&table_id={$table_info.id}" target="_self" class="current_place">添加字段</a>
            <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="10">表字段列表 [{$table_info.name} - <span class="salient">{$config_db_prefix}content{$table_info.setmodel_code}{$table_info.code}</span>]</td>
        </tr>
        <tr class="block_title">
          <td width="5%" nowrap>ID</td>
          <td width="20%" nowrap>名称</td>
          <td width="20%" nowrap>标识</td>
          <td width="15%" nowrap>类型</td>
          <td width="10%" nowrap>组</td>
          <td width="5%" nowrap>长度</td>
          <td width="5%" nowrap>预载</td>
          <td width="5%" nowrap>状态</td>
          <td width="5%" nowrap>排序</td>
          <td width="10%" nowrap>操作</td>
        </tr>
        {foreach name=index_list from=$index_list key=key item=item}
        <tr align="center" class="block_list" onmouseover="this.className='block_list_over'" onmouseout="this.className='block_list'">
          <td nowrap>{$item.id}</td>
          <td align="left" class="text_m">{$item.name}</td>
          <td align="left" class="text_m" nowrap>{$item.code}</td>
          <td align="left" class="text_m" nowrap>字段索引[index]</td>
          <td class="text_m" nowrap>{if $item.team == "1"}主键{elseif $item.team == "2"}关联{elseif $item.team == "3"}系统{else}普通{/if}</td>
          <td class="text_m" nowrap>{$item.length}</td>
          <td class="text_m" nowrap>{if $item.if_preload == "1"}&radic;{/if}</td>
          <td align="left" nowrap>
            {if $item.if_enable == "1"}
              <span style="color:#00AA00;" title="当前状态为开启!">开</span>
            {/if}
          </td>
          <td class="text_m" nowrap>{$item.rank}</td>
          <td class="right_table_control" nowrap>
            {if $item.team == "1" || $item.team == "2" || $item.team == "3"}
            <span class="text_m">~</span>
            {else}
            <a href="{$control_admin}?act=setmodel&ope=field_del&field_id={$item.id}" target="_self" onClick="return confirm('真的要删除记录?')"><img src="{$dir_images_admin}/icon_delete.gif" border="0" alt="删" title="删除" /></a>
            {/if}
          </td>
        </tr>
        {/foreach}
        {foreach name=field_list from=$field_list key=key item=item}
        <tr align="center" class="block_list" onmouseover="this.className='block_list_over'" onmouseout="this.className='block_list'">
          <td nowrap>{$item.id}</td>
          <td align="left">{$item.name}</td>
          <td align="left" nowrap>{$item.code}</td>
          <td align="left" nowrap>{$field_type_list[$item.type].field_name}[{$item.type}]</td>
          <td nowrap>{if $item.team == "1"}主键{elseif $item.team == "2"}关联{elseif $item.team == "3"}系统{else}普通{/if}</td>
          <td nowrap>{$item.length}</td>
          <td nowrap>{if $item.if_preload == "1"}&radic;{/if}</td>
          {if $item.team == "1" || $item.team == "3"}
          <td align="left" nowrap>
            {if $item.if_enable == "1"}
              <span style="color:#00AA00;display:inline-block;width:14px;" title="当前状态为开启!">开</span>
              <span style="color:#EA7408;display:inline-block;width:14px;" title="当前状态为关闭!">&nbsp;</span>
            {else}
              <span style="color:#00AA00;display:inline-block;width:14px;" title="当前状态为开启!">&nbsp;</span>
              <span style="color:#EA7408;display:inline-block;width:14px;" title="当前状态为关闭!">关</span>
            {/if}
          </td>
          {elseif $item.team == "2" && $item.code != "content_id" && ($item.table_recordtype != "2" || $item.link_table_info.recordtype != "2" || $item.link_field_info.if_enable == "1")}
          <td align="left" nowrap>
            {if $item.if_enable == "1"}
              <span style="color:#00AA00;display:inline-block;width:14px;" title="当前状态为开启!">开</span>
              <span style="color:#EA7408;display:inline-block;width:14px;" title="当前状态为关闭!">&nbsp;</span>
            {else}
              <span style="color:#00AA00;display:inline-block;width:14px;" title="当前状态为开启!">&nbsp;</span>
              <span style="color:#EA7408;display:inline-block;width:14px;" title="当前状态为关闭!">关</span>
            {/if}
          </td>
          {else}
          <td align="left" nowrap>
            {if $item.if_enable == "1"}
              <span style="color:#00AA00;display:inline-block;width:14px;" title="当前状态为开启!">开</span>
              <a href="{$control_admin}?act=setmodel&ope=field_if_enable&field_id={$item.id}&if_enable=2" target="_self"><span style="color:#898989;display:inline-block;width:14px;cursor:pointer;" title="将状态更改为关闭!">关</span></a>
            {else}
              <a href="{$control_admin}?act=setmodel&ope=field_if_enable&field_id={$item.id}&if_enable=1" target="_self"><span style="color:#898989;display:inline-block;width:14px;cursor:pointer;" title="将状态更改为开启!">开</span></a>
              <span style="color:#EA7408;display:inline-block;width:14px;" title="当前状态为关闭!">关</span>
            {/if}
          </td>
          {/if}
          <td nowrap>{$item.rank}</td>
          <td class="right_table_control" nowrap>
            {if $item.team == "1" || $item.team == "2" || $item.team == "3"}
            ~
            {else}
            <a href="{$control_admin}?act=setmodel&ope=field_amend&field_id={$item.id}" target="_self"><img src="{$dir_images_admin}/icon_edit.gif" border="0" alt="改" title="修改字段" /></a>
            <a href="{$control_admin}?act=setmodel&ope=field_del&field_id={$item.id}" target="_self" onClick="return confirm('真的要删除记录?')"><img src="{$dir_images_admin}/icon_delete.gif" border="0" alt="删" title="删除" /></a>
            {/if}
          </td>
        </tr>
        {/foreach}
      </table>
      <div class="space"></div>
      <form id="field_index_add" name="field_index_add" method="post" action="javascript:void(null);" enctype="multipart/form-data">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr class="block_footer" align="center">
          <td width="10%" nowrap>添加索引</td>
          <td width="20%" align="left" nowrap>索引名称:<input type="text" id="name" name="name" size="16" maxlength="255" value="" class="input" /></td>
          <td width="40%" align="left" nowrap>索引字段标识(,分隔):<input type="text" id="code" name="code" size="36" maxlength="255" value="" class="input" /></td>
          <td width="10%" align="left" nowrap>排序:<input type="text" id="rank" name="rank" maxlength="11" size="1" value="0" class="input" /></td>
          <td width="10%" nowrap>
            <input type="button" id="field_index_submit" name="field_index_submit" value="添加索引" class="button"
              onclick="xajax.$('field_index_submit').disabled=true;
                       xajax.$('field_index_submit').value='请等待...';
                       xajax_field_index_add(xajax.getFormValues('field_index_add'),'field_index_submit');">
          </td>
        </tr>
      </table>
      </form>
      </div>
      {elseif $get.ope == "field_add"}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=table&setmodel_id={$table_info.setmodel_id}" target="_self" class="current_place">模型表列表[{$table_info.setmodel_name}]</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=field_list&table_id={$table_info.id}" target="_self" class="current_place">表字段列表[{$table_info.name}]</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=field_add&table_id={$table_info.id}" target="_self" class="current_place">添加字段</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel&ope=field_list&table_id={$table_info.id}" target="_self" class="current_place">字段列表</a>
            <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <form id="field_add" name="field_add" method="post" action="javascript:void(null);" enctype="multipart/form-data">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="3">添加模型</td>
        </tr>
        <tr align="left">
          <td width="20%" class="block_left">字段名称</td>
          <td width="40%" class="block_right"><input type="text" id="name" name="name" maxlength="11" size="50" value="" class="input"></td>
          <td width="40%" class="block_right"><span id="name_return"><span class="prompt_primal">此字段名称</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段标识</td>
          <td class="block_right"><input type="text" id="code" name="code" maxlength="60" size="50" value="" class="input"></td>
          <td class="block_right"><span id="code_return"><span class="prompt_primal">字段标识用于建立数据库字段以及各种识别用</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">数据类型</td>
          <td class="block_right">
          <select id="type" name="type" class="select">
            <option value=""></option>
            {foreach name=field_type_list from=$field_type_list item=item}
            {if $item.field_type != "index"}
            <option value="{$item.field_type}">{$item.field_name}[{$item.field_type}]</option>
            {/if}
            {/foreach}
          </select>
          </td>
          <td class="block_right"><span id="type_return"><span class="prompt_primal">数据类型决定此字段将如何构建实现</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段组别</td>
          <td class="block_right">普通</td>
          <td class="block_right"><span id="team_return"><span class="prompt_primal"></span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段长度</td>
          <td class="block_right"><input type="text" id="length" name="length" maxlength="255" size="50" value="" class="input"></td>
          <td class="block_right"><span id="length_return"><span class="prompt_primal">根据数据类型会有不同长度,请不要超过各自长度</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">提示信息</td>
          <td class="block_right"><input type="text" id="prompt" name="prompt" maxlength="255" size="50" value="" class="input"></td>
          <td class="block_right"><span id="prompt_return"><span class="prompt_primal">提示信息将用来对此字段进行详细说明</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">前期处理</td>
          <td class="block_right"><input type="text" id="handle_before" name="handle_before" maxlength="255" size="50" value="" class="input"></td>
          <td class="block_right"><span id="handle_before_return"><span class="prompt_primal">添加数据时存入数据库前的处理</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">后期处理</td>
          <td class="block_right"><input type="text" id="handle_alfter" name="handle_alfter" maxlength="255" size="50" value="" class="input"></td>
          <td class="block_right"><span id="handle_alfter_return"><span class="prompt_primal">显示数据时显示前的处理</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段值</td>
          <td class="block_right"><textarea id="value" name="value" rows="6" cols="50" class="textarea"></textarea></td>
          <td class="block_right">
            <span id="value_return">
              <span class="prompt_primal"><b>下拉框,单选,多选数据类型:</b>[<span class="salient">序号</span>,<span class="salient">名称</span>,<span class="salient">值</span>:<span class="salient">默认</span>|...]<br />
              <span class="salient">序号</span>必须唯一,<span class="salient">默认</span>可留空,组之间用|分隔<br />
              如:1,男,male:1|2,女,female</span><br />
              <span class="prompt_primal"><b>附件数据类型:</b>[<span class="salient">.扩展名</span>|...]<br />
              <span class="salient">.扩展名</span>之间用|分隔<br />
              如:.jpg|.gif</span>
            </span>
          </td>
        </tr>
        <tr align="left">
          <td class="block_left">自定义HTML</td>
          <td class="block_right"><textarea id="html" name="html" rows="6" cols="50" class="textarea"></textarea></td>
          <td class="block_right"><span id="html_return"><span class="prompt_primal">自定义添加数据时此字段表单的HTML</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">预先载入</td>
          <td class="block_right">
            <input type="radio" name="if_preload" value="1" checked class="radio_y">&nbsp;开启
            <input type="radio" name="if_preload" value="2" class="radio_n">&nbsp;关闭
          </td>
          <td class="block_right"><span id="if_preload_return"><span class="prompt_primal">在列表页等位置是否预先载入</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段状态</td>
          <td class="block_right">
            <input type="radio" name="if_enable" value="1" checked class="radio_y">&nbsp;开启
            <input type="radio" name="if_enable" value="2" class="radio_n">&nbsp;关闭
          </td>
          <td class="block_right"><span id="if_enable_return"><span class="prompt_primal">是否开启此字段</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段排序</td>
          <td class="block_right"><input type="text" id="rank" name="rank" maxlength="11" size="50" value="0" class="input"></td>
          <td class="block_right"><span id="rank_return"><span class="prompt_primal">字段排序</span></span></td>
        </tr>
        <tr>
          <td colspan="3" align="center" class="block_footer">
          <input type="button" id="field_submit" name="field_submit" value="添加" class="button"
            onclick="xajax.$('field_submit').disabled=true;
                     xajax.$('field_submit').value='请等待...';
                     xajax_field_form('add',xajax.getFormValues('field_add'),'field_submit');">
          </td>
        </tr>
      </table>
      </form>
      </div>
      {elseif $get.ope == "field_amend"}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=table&setmodel_id={$field_info.setmodel_id}" target="_self" class="current_place">模型表列表[{$field_info.setmodel_name}]</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=field_list&table_id={$field_info.table_id}" target="_self" class="current_place">表字段列表[{$field_info.table_name}]</a>
            &raquo; <a href="{$control_admin}?act=setmodel&ope=field_amend&field_id={$field_info.id}" target="_self" class="current_place">字段修改[{$field_info.name|str_cut:0:12:'...'}]</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel&ope=field_list&table_id={$field_info.table_id}" target="_self" class="current_place">字段列表</a>
            <a href="{$control_admin}?act=setmodel&ope=field_list&&ope=field_add&table_id={$field_info.table_id}" target="_self" class="current_place">字段添加</a>
            <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <form id="field_amend" name="field_amend" method="post" action="javascript:void(null);" enctype="multipart/form-data">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="3">编辑字段</td>
        </tr>
        <tr align="left">
          <td width="20%" class="block_left">ID</td>
          <td width="40%" class="block_right">{$field_info.id}</td>
          <td width="40%" class="block_right"></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段名称</td>
          <td class="block_right"><input type="text" id="name" name="name" maxlength="11" size="50" value="{$field_info.name}" class="input"></td>
          <td class="block_right"><span id="name_return"><span class="prompt_primal">此字段名称</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段标识</td>
          <td class="block_right"><input type="text" id="code" name="code" maxlength="60" size="50" value="{$field_info.code}" class="input"></td>
          <td class="block_right"><span id="code_return"><span class="prompt_primal">字段标识用于建立数据库字段以及各种识别用</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">数据类型</td>
          <td class="block_right">
          <select id="type" name="type" class="select">
            <option value=""></option>
            {foreach name=field_type_list from=$field_type_list item=item}
            {if $item.field_type != "index"}
            {if $item.field_type == $field_info.type}
            <option value="{$item.field_type}" selected>{$item.field_name}[{$item.field_type}]</option>
            {else}
            <option value="{$item.field_type}">{$item.field_name}[{$item.field_type}]</option>
            {/if}
            {/if}
            {/foreach}
          </select>
          </td>
          <td class="block_right"><span id="type_return"><span class="prompt_primal">数据类型决定此字段将如何构建实现</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段组别</td>
          <td class="block_right">{if $field_info.team == "1"}主键{elseif $field_info.team == "2"}关联{elseif $field_info.team == "3"}系统{else}普通{/if}</td>
          <td class="block_right"><span id="team_return"><span class="prompt_primal"></span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段长度</td>
          <td class="block_right"><input type="text" id="length" name="length" maxlength="255" size="50" value="{$field_info.length}" class="input"></td>
          <td class="block_right"><span id="length_return"><span class="prompt_primal">根据数据类型会有不同长度,请不要超过各自长度</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">提示信息</td>
          <td class="block_right"><input type="text" id="prompt" name="prompt" maxlength="255" size="50" value="{$field_info.prompt}" class="input"></td>
          <td class="block_right"><span id="prompt_return"><span class="prompt_primal">提示信息将用来对此字段进行详细说明</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">前期处理</td>
          <td class="block_right"><input type="text" id="handle_before" name="handle_before" maxlength="255" size="50" value="{$field_info.handle_before}" class="input"></td>
          <td class="block_right"><span id="handle_before_return"><span class="prompt_primal">添加数据时存入数据库前的处理</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">后期处理</td>
          <td class="block_right"><input type="text" id="handle_alfter" name="handle_alfter" maxlength="255" size="50" value="{$field_info.handle_alfter}" class="input"></td>
          <td class="block_right"><span id="handle_alfter_return"><span class="prompt_primal">显示数据时显示前的处理</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段值</td>
          <td class="block_right"><textarea id="value" name="value" rows="6" cols="50" class="textarea">{$field_info.value}</textarea></td>
          <td class="block_right">
            <span id="value_return">
              <span class="prompt_primal"><b>下拉框,单选,多选数据类型:</b>[<span class="salient">序号</span>,<span class="salient">名称</span>,<span class="salient">值</span>:<span class="salient">默认</span>|...]<br />
              <span class="salient">序号</span>必须唯一,<span class="salient">默认</span>可留空,组之间用|分隔<br />
              如:1,男,male:1|2,女,female</span><br />
              <span class="prompt_primal"><b>附件数据类型:</b>[<span class="salient">.扩展名</span>|...]<br />
              <span class="salient">.扩展名</span>之间用|分隔<br />
              如:.jpg|.gif</span>
            </span>
          </td>
        </tr>
        <tr align="left">
          <td class="block_left">自定义HTML</td>
          <td class="block_right"><textarea id="html" name="html" rows="6" cols="50" class="textarea">{$field_info.html}</textarea></td>
          <td class="block_right"><span id="html_return"><span class="prompt_primal">自定义添加数据时此字段表单的HTML</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">预先载入</td>
          <td class="block_right">
            <input type="radio" name="if_preload" value="1" {if $field_info.if_preload == "1"}checked{/if} class="radio_y">&nbsp;开启
            <input type="radio" name="if_preload" value="2" {if $field_info.if_preload != "1"}checked{/if} class="radio_n">&nbsp;关闭
          </td>
          <td class="block_right"><span id="if_preload_return"><span class="prompt_primal">在列表页等位置是否预先载入</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段状态</td>
          <td class="block_right">
            <input type="radio" name="if_enable" value="1" {if $field_info.if_enable == "1"}checked{/if} class="radio_y">&nbsp;开启
            <input type="radio" name="if_enable" value="2" {if $field_info.if_enable != "1"}checked{/if} class="radio_n">&nbsp;关闭
          </td>
          <td class="block_right"><span id="if_enable_return"><span class="prompt_primal">是否开启此字段</span></span></td>
        </tr>
        <tr align="left">
          <td class="block_left">字段排序</td>
          <td class="block_right"><input type="text" id="rank" name="rank" maxlength="11" size="50" value="{$field_info.rank}" class="input"></td>
          <td class="block_right"><span id="rank_return"><span class="prompt_primal">字段排序</span></span></td>
        </tr>
        <tr>
          <td colspan="3" align="center" class="block_footer">
          <input type="button" id="field_submit" name="field_submit" value="编辑" class="button"
            onclick="xajax.$('field_submit').disabled=true;
                     xajax.$('field_submit').value='请等待...';
                     xajax_field_form('amend',xajax.getFormValues('field_amend'),'field_submit');">
          </td>
        </tr>
      </table>
      </form>
      </div>
      {else}
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="current_place">
        <tr>
          <td align="left" nowrap>&nbsp;
            <a href="{$control_admin}" target="_self" class="current_place">管理首页</a>
            &raquo; <a href="{$control_admin}?act=setmodel" target="_self" class="current_place">模型列表</a>
          </td>
          <td align="right" nowrap>
            [
            <a href="{$control_admin}?act=setmodel&ope=add" target="_self" class="current_place">模型添加</a>
            ]
          </td>
        </tr>
      </table>
      </div>

      <div class="space"></div>
      <div class="right_table">
      <table width="100%" cellpadding="3" cellspacing="0" border="0" align="center" class="block_group">
        <tr align="left" class="block_header">
          <td colspan="12">模型列表</td>
        </tr>
        <tr class="block_title">
          <td width="5%">ID</td>
          <td width="15%">名称</td>
          <td width="15%">标识</td>
          <td width="20%">频道页模板</td>
          <td width="20%">详细页模板</td>
          <td width="10%">状态</td>
          <td width="5%">排序</td>
          <td width="10%">操作</td>
        </tr>
        {foreach name=setmodel_list from=$setmodel_list key=key item=item}
        <tr align="center" class="block_list" onmouseover="this.className='block_list_over'" onmouseout="this.className='block_list'">
          <td>{$item.id}</td>
          <td align="left">{$item.name}</td>
          <td align="left">{$item.code}</td>
          <td align="left">{$item.template_channel}</td>
          <td align="left">{$item.template_content}</td>
          <td nowrap>
            {if $item.if_enable == "1"}
              <span style="color:#00AA00;" title="当前状态为开启!">开</span>
              <a href="{$control_admin}?act=setmodel&ope=if_enable&setmodel_id={$item.id}&if_enable=2" target="_self"><span style="color:#898989;" title="将状态更改为关闭!">关</span></a>
            {else}
              <a href="{$control_admin}?act=setmodel&ope=if_enable&setmodel_id={$item.id}&if_enable=1" target="_self"><span style="color:#898989;" title="将状态更改为开启!">开</span></a>
              <span style="color:#EA7408;" title="当前状态为关闭!">关</span>
            {/if}
          </td>
          <td>{$item.rank}</td>
          <td class="right_table_control">
            <a href="{$control_admin}?act=setmodel&ope=amend&setmodel_id={$item.id}" target="_self"><img src="{$dir_images_admin}/icon_edit.gif" border="0" alt="改" title="修改字段" /></a>
            <a href="{$control_admin}?act=setmodel&ope=table&setmodel_id={$item.id}" target="_self"><img src="{$dir_images_admin}/icon_list.gif" border="0" alt="表" title="模型表列表" /></a>
            <a href="{$control_admin}?act=setmodel&ope=del&setmodel_id={$item.id}" target="_self" onClick="return confirm('真的要删除记录?')"><img src="{$dir_images_admin}/icon_delete.gif" border="0" alt="删" title="删除" /></a>
          </td>
        </tr>
        {/foreach}
      </table>
      </div>
      {/if}

    </td>
  </tr>
</table>
{include file="pub_footer.htm"}